package com.mx.recycle_demo.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.mx.recycle_demo.R
import com.mx.recycle_demo.adapt.SimpleImgAdapt
import kotlinx.android.synthetic.main.activity_loop_pager.*


class LoopPagerActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_loop_pager)
        val adapter = SimpleImgAdapt(
            arrayListOf(
                R.mipmap.item1, R.mipmap.item2, R.mipmap.item3, R.mipmap.item4,
                R.mipmap.item5, R.mipmap.item6
            )
        )
        zRecycleView.adapter = adapter
        adapter.notifyDataSetChanged()
        adapter.setItemClick { index, record ->
            zRecycleView.smoothScrollToPosition(index)
        }
    }
}